/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class ListCarteleraDeCinev2Data {
	private static final int ROW_COUNT = 100;
	
public void listTestData() throws PersistentException {
		com.nicolascarrascob.pds.serviciosoap.orm.DAOFactory lDAOFactory = com.nicolascarrascob.pds.serviciosoap.orm.DAOFactory.getDAOFactory();
		System.out.println("Listing Pelicula...");
		com.nicolascarrascob.pds.serviciosoap.orm.Pelicula[] comnicolascarrascobpdsserviciosoapormPeliculas = lDAOFactory.getPeliculaDAO().listPeliculaByQuery(null, null);
		int length = Math.min(comnicolascarrascobpdsserviciosoapormPeliculas.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(comnicolascarrascobpdsserviciosoapormPeliculas[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Genero...");
		com.nicolascarrascob.pds.serviciosoap.orm.Genero[] comnicolascarrascobpdsserviciosoapormGeneros = lDAOFactory.getGeneroDAO().listGeneroByQuery(null, null);
		length = Math.min(comnicolascarrascobpdsserviciosoapormGeneros.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(comnicolascarrascobpdsserviciosoapormGeneros[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Clasificacion...");
		com.nicolascarrascob.pds.serviciosoap.orm.Clasificacion[] comnicolascarrascobpdsserviciosoapormClasificacions = lDAOFactory.getClasificacionDAO().listClasificacionByQuery(null, null);
		length = Math.min(comnicolascarrascobpdsserviciosoapormClasificacions.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(comnicolascarrascobpdsserviciosoapormClasificacions[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Sala...");
		com.nicolascarrascob.pds.serviciosoap.orm.Sala[] comnicolascarrascobpdsserviciosoapormSalas = lDAOFactory.getSalaDAO().listSalaByQuery(null, null);
		length = Math.min(comnicolascarrascobpdsserviciosoapormSalas.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(comnicolascarrascobpdsserviciosoapormSalas[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
	}
	
	public void listByCriteria() throws PersistentException  {
		System.out.println("Listing Pelicula by Criteria...");
		com.nicolascarrascob.pds.serviciosoap.orm.PeliculaCriteria peliculaCriteria = new com.nicolascarrascob.pds.serviciosoap.orm.PeliculaCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//peliculaCriteria.id.eq();
		peliculaCriteria.setMaxResults(ROW_COUNT);
		com.nicolascarrascob.pds.serviciosoap.orm.Pelicula[] comnicolascarrascobpdsserviciosoapormPeliculas = peliculaCriteria.listPelicula();
		int length =comnicolascarrascobpdsserviciosoapormPeliculas== null ? 0 : Math.min(comnicolascarrascobpdsserviciosoapormPeliculas.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(comnicolascarrascobpdsserviciosoapormPeliculas[i]);
		}
		System.out.println(length + " Pelicula record(s) retrieved."); 
		
		System.out.println("Listing Genero by Criteria...");
		com.nicolascarrascob.pds.serviciosoap.orm.GeneroCriteria generoCriteria = new com.nicolascarrascob.pds.serviciosoap.orm.GeneroCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//generoCriteria.id.eq();
		generoCriteria.setMaxResults(ROW_COUNT);
		com.nicolascarrascob.pds.serviciosoap.orm.Genero[] comnicolascarrascobpdsserviciosoapormGeneros = generoCriteria.listGenero();
		length =comnicolascarrascobpdsserviciosoapormGeneros== null ? 0 : Math.min(comnicolascarrascobpdsserviciosoapormGeneros.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(comnicolascarrascobpdsserviciosoapormGeneros[i]);
		}
		System.out.println(length + " Genero record(s) retrieved."); 
		
		System.out.println("Listing Clasificacion by Criteria...");
		com.nicolascarrascob.pds.serviciosoap.orm.ClasificacionCriteria clasificacionCriteria = new com.nicolascarrascob.pds.serviciosoap.orm.ClasificacionCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//clasificacionCriteria.id.eq();
		clasificacionCriteria.setMaxResults(ROW_COUNT);
		com.nicolascarrascob.pds.serviciosoap.orm.Clasificacion[] comnicolascarrascobpdsserviciosoapormClasificacions = clasificacionCriteria.listClasificacion();
		length =comnicolascarrascobpdsserviciosoapormClasificacions== null ? 0 : Math.min(comnicolascarrascobpdsserviciosoapormClasificacions.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(comnicolascarrascobpdsserviciosoapormClasificacions[i]);
		}
		System.out.println(length + " Clasificacion record(s) retrieved."); 
		
		System.out.println("Listing Sala by Criteria...");
		com.nicolascarrascob.pds.serviciosoap.orm.SalaCriteria salaCriteria = new com.nicolascarrascob.pds.serviciosoap.orm.SalaCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//salaCriteria.idSala.eq();
		salaCriteria.setMaxResults(ROW_COUNT);
		com.nicolascarrascob.pds.serviciosoap.orm.Sala[] comnicolascarrascobpdsserviciosoapormSalas = salaCriteria.listSala();
		length =comnicolascarrascobpdsserviciosoapormSalas== null ? 0 : Math.min(comnicolascarrascobpdsserviciosoapormSalas.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(comnicolascarrascobpdsserviciosoapormSalas[i]);
		}
		System.out.println(length + " Sala record(s) retrieved."); 
		
	}
	
	public static void main(String[] args) {
		try {
			ListCarteleraDeCinev2Data listCarteleraDeCinev2Data = new ListCarteleraDeCinev2Data();
			try {
				listCarteleraDeCinev2Data.listTestData();
				//listCarteleraDeCinev2Data.listByCriteria();
			}
			finally {
				com.nicolascarrascob.pds.serviciosoap.orm.CarteleraDeCinev2PersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
